package com.xbb.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;
import com.xbb.mapper.AppointmentMapper;
import com.xbb.entity.Appointment;
import com.xbb.service.AppointmentService;
import org.springframework.stereotype.Service;

@Service
public class AppointmentServiceImpl implements AppointmentService {

    @Resource
    private AppointmentMapper appointmentMapper;

    // 删除数据
    @Override
    public int deleteByPrimaryKey(Integer id) {
        return appointmentMapper.deleteByPrimaryKey(id);
    }

    // 插入数据
    @Override
    public int insert(Appointment appointment) {
        return appointmentMapper.insert(appointment);
    }

    // 插入数据
    @Override
    public int insertSelective(Appointment appointment) {
        return appointmentMapper.insertSelective(appointment);
    }

    // 根据ID查询单个数据
    @Override
    public Appointment selectByPrimaryKey(Integer id) {
        return appointmentMapper.selectByPrimaryKey(id);
    }

    // 修改数据
    @Override
    public int updateByPrimaryKeySelective(Appointment appointment) {
        return appointmentMapper.updateByPrimaryKeySelective(appointment);
    }

    // 修改数据
    @Override
    public int updateByPrimaryKey(Appointment appointment) {
        return appointmentMapper.updateByPrimaryKey(appointment);
    }

    // 根据条件查询分页数据
    @Override
    public List<Appointment> selectListByPaging(Integer page, Integer limit,Integer servicesId, Integer userId, String appointmentDate, String matter, Integer status, Date creatDate, Integer staffId, String number) {
        return appointmentMapper.selectListByPaging(
            (page - 1) * limit,
            limit,
            servicesId,
            userId,
            appointmentDate,
            matter,
            status,
            creatDate,
            staffId,
            number
        );
    }

    // 根据条件查询数据条数
    @Override
    public int selectCountByPaging(Integer servicesId, Integer userId, String appointmentDate, String matter, Integer status, Date creatDate, Integer staffId, String number) {
        return appointmentMapper.selectCountByPaging(
            servicesId,
            userId,
            appointmentDate,
            matter,
            status,
            creatDate,
            staffId,
            number
        );
    }

    // 查询全部数据
    @Override
    public List<Appointment> selectAll() {
        return appointmentMapper.selectAll();
    }

    // 根据条件查询列表数据
    @Override
    public List<Appointment> selectList(Appointment appointment) {
        return appointmentMapper.selectList(appointment);
    }

    // 根据字段、排序方式、limit条 查询列表数据
    @Override
    public List<Appointment> selectListByLimit(String field, String sort, Integer limit) {
        return appointmentMapper.selectListByLimit(field, sort, limit);
    }

    // 根据字段查询列表数据
    @Override
    public List<Appointment> selectListByField(String field, Object value) {
        return appointmentMapper.selectListByField(field, value);
    }

    // 根据条件查询单个数据
    @Override
    public Appointment selectOne(Appointment appointment) {
        return appointmentMapper.selectOne(appointment);
    }

    // 根据ID查询详情数据
    @Override
    public Appointment selectOneByDetails(Integer id) {
        return appointmentMapper.selectOneByDetails(id);
    }

    // 查询全部条数
    @Override
    public int selectAllCount() {
        return appointmentMapper.selectAllCount();
    }

    // 根据条件查询数据条数
    @Override
    public int selectCount(Appointment appointment) {
        return appointmentMapper.selectCount(appointment);
    }

    // 根据条件修改全部数据
    @Override
    public int updateAll(Appointment appointment) {
        return appointmentMapper.updateAll(appointment);
    }

    @Override
    public int selectStatisticByYear(Integer year, Integer month) {
        return appointmentMapper.selectStatisticByYear(year, month);
    }
}
